package com.alisls.demo.springcloud.stream.rabbit.web;

import com.alisls.demo.springcloud.stream.rabbit.producer.MessageProducer;
import com.alisls.demo.springcloud.stream.rabbit.producer.MessageSender;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 描述信息
 *
 * @author Ke Wang
 * @date 2020/10/15
 */
@RestController
@RequestMapping("/producer")
public class ProducerController {

    @Resource
    private MessageSender messageSender;

    @Resource
    private MessageProducer messageProducer;

    @RequestMapping("/sendMessage")
    public String sendMessage(@RequestParam String message) {
        // 方式一
        // messageSender.sendMessage(message);

        // 方式二
        messageProducer.sendMessage(message);

        return "ok";
    }

}
